package net.ojbk.study.twobox.web.handlers;

import net.ojbk.study.twobox.beans.vo.JoinJob;
import net.ojbk.study.twobox.service.O_JoinJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/4/18
 * Time: 12:57
 * Description: No Description
 */
@Controller
@RequestMapping("/joinjob")
public class O_JoinJobController {

    @Autowired
    O_JoinJobService o_joinJobService;

    @RequestMapping(value = "", method = RequestMethod.POST)
    public ResponseEntity<Object> toJob(@RequestBody JoinJob joinJob) throws Exception {
        // 修改学生的就业状态为 刚入职
        o_joinJobService.toJob(joinJob);
        return new ResponseEntity<>("success.", HttpStatus.OK);
    }

    @RequestMapping(value = "classList", method = RequestMethod.GET)
    public ResponseEntity<Object> getAll_Class() throws Exception {
        return new ResponseEntity<>(o_joinJobService.getAll_Class(), HttpStatus.OK);
    }

    @RequestMapping(value = "jobcompany", method = RequestMethod.GET)
    public ResponseEntity<Object> getAll_JobCompany() throws Exception {
        return new ResponseEntity<>(o_joinJobService.getAll_Jobcompany(), HttpStatus.OK);
    }

    @RequestMapping(value = "{classId}/{page}", method = RequestMethod.GET)
    public ResponseEntity<Object> getAll_JoinJob_ByClassId(@PathVariable("classId") Integer classId, @PathVariable("page") Integer page) throws Exception {
        return new ResponseEntity<>(o_joinJobService.getAll_JoinJob_ByClassId(page, classId), HttpStatus.OK);
    }


}
